package es.uji.viselab.benchmark.process;

import java.awt.Button;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BoxLayout;
import javax.swing.JPanel;

import es.uji.viselab.ViSeLabComponent;
import es.uji.viselab.benchmark.database.DBConnection;
import es.uji.viselab.experiment.ExperimentParameters;

public abstract class BenchMarkingProcessor implements ActionListener, ViSeLabComponent {
	
	DBConnection dbConnection;
	JPanel rootPanel;
	//ExperimentParameters ep;
	protected Button buttonRun = new Button("Run");

	BenchMarkingProcessor() {
		createContent();
	}

	public void setDataSource(DBConnection db) {
		this.dbConnection = db;
	}

	public abstract void run();

	protected void createContent() {
		rootPanel = new JPanel();
		rootPanel.setLayout(new BoxLayout(rootPanel, BoxLayout.PAGE_AXIS));

		JPanel line0 = new JPanel();
		line0.setLayout(new FlowLayout());
		line0.add(buttonRun);
		
		buttonRun.addActionListener(this);
		rootPanel.add(line0);

	}

	public JPanel getPanel() {
		return rootPanel;
	}
	
	@Override
	public void actionPerformed(ActionEvent ae) {
		if (ae.getSource().equals(buttonRun))
			run();
	}

	

}
